package com.greatwqs.wmall.order.provider.util;

import com.greatwqs.wmall.order.client.enums.OrderType;

import org.apache.commons.lang3.time.DateFormatUtils;

public class OrderUtils {

    public static String getOrderNo(OrderType orderType) {
        final long nowMs = System.currentTimeMillis();
        StringBuilder builder = new StringBuilder();
        builder.append(orderType.getValue());
        builder.append("-");
        builder.append(DateFormatUtils.format(nowMs, "yyyyMMdd-HHmmss-SSS"));
        builder.append("-");
        builder.append(SequenceUtils.getSequenceId(nowMs));
        return builder.toString();
    }

}
